<?php
namespace app\backend\controller;
use app\backend\service\LoginService;
use app\common\RootController;
use app\common\RootException;

class Login extends Backend
{
    /**
     * 用户登录
     * @param LoginService $service
     * @return string|\think\response\Json
     * @throws RootException
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function index(LoginService $service)
    {
        if ($this->request->isAjax()) {
            $loginResult = $service->login($this->request->param());
            return $this->success($loginResult);
        }
        return $this->fetch('login/login');
    }


}